package org.spring.boot.multiple.jdbctemplate.ws;

import org.spring.boot.multiple.jdbctemplate.dao.IrmsCityDao;
import org.spring.boot.multiple.jdbctemplate.dao.TmpTabDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author: eastcom
 * @desc:
 **/
@RestController
@RequestMapping("/spring/boot/multiple/jdbctemplate")
public class TmpTabWs {

	@Autowired
	private IrmsCityDao irmsCityDao;

	@Autowired
	private TmpTabDao tmpTabDao;

	@RequestMapping(value = "/list/{city_id}", method = RequestMethod.GET)
	public List<Map<String, Object>> queryForList(@PathVariable("city_id") String cityId){
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		list.addAll(this.irmsCityDao.queryForList(cityId));
		list.addAll(this.tmpTabDao.queryForList());
		return list;
	}
}
